<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<jsp:useBean id="usuario" class="app.engine.solucoes.request.beans.Usuario" scope="session" />
<jsp:useBean id="usuarioUpdate" class="app.engine.solucoes.request.beans.Usuario" scope="request" />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
	<script type="text/javascript" src="/javascript/script.js"></script>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title><%=usuario.getNomeUsuario() != null ? usuario.getNomeUsuario() : ""%> - [Alteração de Usuario]</title>
</head>
<body>
<%
	if (usuario.getId() == null || !usuario.getEhModerador())
		response.sendRedirect("/");
%>
	<form name="menu" action="faqtool" method="post">
		<input type="hidden" name="cmd" value="" />
		<input type="hidden" name="token" value="<%= request.getAttribute("token") %>" />
		<input type="hidden" name="loginTemp" value="<%=request.getAttribute("loginTemp") %>" />
		<table border="1" align="center">
			<tr>
				<td>
				<table bgcolor="tan" border="0" align="center" cellpadding="10"
					cellspacing="0">
					<tr>
						<th colspan="2">Manutenção de <%=usuario.getLogin().equals("administrador") ? "Empresa" : "Usuario" %></th>
					</tr>
					<% if (!usuario.getLogin().equals("administrador")) { %>
					<tr>
						<td><b>Nome:</b></td>
						<td><input type="text" name="nome" size="35" value="<%=usuarioUpdate.getNomeUsuario() %>" /></td>
					</tr>
					<%} %>
					<tr>
						<td><b>Email:</b></td>
						<td><input type="text" name="email" size="35" value="<%=usuarioUpdate.getEmail() %>"></td>
					</tr>
					<tr>
						<td><b>Login:</b></td>
						<td><input type="text" name="login" size="35" value="<%=usuarioUpdate.getLogin() %>" 
								   disabled="disabled"/></td>
					</tr>
					<tr>
						<td><b>Senha:</b></td>
						<td><input type="password" name="senha" size="35" value="" /></td>
					</tr>
					<% if (usuario.getNomeUsuario().contains("Empresa")) { %>
					<tr>
						<td><b>Moderador:</b></td>
						<td><input type="checkbox" name="ehModerador" <%= usuarioUpdate.getEhModerador() ? "checked=\"checked\"" : "" %> /></td>
					</tr>
					<%} %>
					<tr>
						<td><b>Ativo:</b></td>
						<td><input type="checkbox" name="ativo" <%= usuarioUpdate.getAtivo() ? "checked=\"checked\"" : "" %> /></td>
					</tr>
					<tr>
						<td colspan="2" align="center">
							<input type="submit" value="Menu Principal" onClick="document.menu.cmd.value='main-menu'" />
							<input type="submit" value="Voltar" onClick="document.menu.cmd.value='all-user'" />
							<input type="submit" value="Alterar" onClick="document.menu.cmd.value='do-update-user'"/>
							<input type="submit" value="Sair" onClick="setCmd('exit')" />
						</td>
					</tr>
					<% if (request.getAttribute("faqtool.msg") != null) { %>
						<tr>
							<td colspan="2" bgcolor="white">
								<font size="-1" color="<%=request.getAttribute("corFonte") != null ? request.getAttribute("corFonte") : "black"%>"> 
									<i><%=request.getAttribute("faqtool.msg")%></i>
								</font>
							</td>
						</tr>
					<%} %>
				</table>
				</td>
			</tr>
		</table>
	</form>
</body>
</html>